package osirix.ce;

import java.io.IOException;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ListarComparendos extends Activity {
	
	ListView listView;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.listcomparendositems);
		this.listarComparendos();
	}
	
	private void listarComparendos() {
		 
		 
		try {
			listView = (ListView) findViewById(R.id.listView1);
			
			UtilSQLite objUtilSql = new UtilSQLite(this);
			objUtilSql.createDataBase();
			objUtilSql.open();
			ArrayAdapter<DatosComparendo> data = new ArrayAdapter<DatosComparendo>(this, android.R.layout.simple_spinner_item, objUtilSql.getAllComparendos());
			Log.d("Listar Activity:", "Hasta aca bien" + data.getItem(0).getIdComparendo());
			
			if (data != null) {
				listView.setAdapter(data);
			}
			
			objUtilSql.close();
			
			
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		
	}

}
